package com.example.interviewrecorder.viewmodel

import androidx.lifecycle.ViewModel
import com.example.interviewrecorder.model.Rating
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow

class RecordViewModel : ViewModel() {
    private val mUserId = MutableStateFlow<Long>(0)
    val userId = mUserId.asStateFlow()

    private val mTitle = MutableStateFlow("")
    val title = mTitle.asStateFlow()

    private val mContent = MutableStateFlow("")
    val content = mContent.asStateFlow()

    private val mCorporateName = MutableStateFlow("")
    val corporateName = mCorporateName.asStateFlow()

    private val mDuration = MutableStateFlow("")
    val duration = mDuration.asStateFlow()

    private val mItvDate = MutableStateFlow<Long>(0)
    val itvDate = mItvDate.asStateFlow()

    private val mRating = MutableStateFlow(5)
    val rating = mRating.asStateFlow()

    private val mCreatedTime = MutableStateFlow<Long>(0)
    val createdTime = mCreatedTime.asStateFlow()

    private val mUpdatedTime = MutableStateFlow<Long>(0)
    val updatedTime = mUpdatedTime.asStateFlow()

    fun setTitle(title: String) {
        mTitle.value = title
    }

    fun setContent(content: String) {
        mContent.value = content
    }

    fun setCorporateName(corporateName: String) {
        mCorporateName.value = corporateName
    }

    fun setDuration(duration: String) {
        mDuration.value = duration
    }

    fun setItvDate(itvDate: Long) {
        mItvDate.value = itvDate
    }

    fun setrRating(rating: Rating) {
        mRating.value = rating.toRatingId()
    }

    fun setCreatedTime(createdTime: Long) {
        mCreatedTime.value = createdTime
    }

    fun setUpdatedTime(updatedTime: Long) {
        mUpdatedTime.value = updatedTime
    }
}